package com.psq.core.common.utils

import android.app.Activity
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.callback.NavigationCallback
import com.alibaba.android.arouter.launcher.ARouter

fun navigation(path: String) {
    ARouter.getInstance().build(path).navigation()
}

fun navigation(path: String, block: Postcard.() -> Unit) {
    ARouter.getInstance().build(path).apply(block).navigation()
}

fun navigation(activity: Activity, requestCode: Int, path: String, block: Postcard.() -> Unit) {
    ARouter.getInstance().build(path).apply(block).navigation(activity, requestCode)
}

fun navigation(
    path: String,
    activity: Activity,
    // code必须大于0才有效
    requestCode: Int = 0,
    callback: NavigationCallback? = null
) {
    ARouter.getInstance().build(path).navigation(activity, requestCode, callback)
}